package com.wy.common;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @描述
 * @创建人 wangyue
 * @创建时间2019/12/416:19
 */
@ControllerAdvice
public class ExceptionCatch {

    @ExceptionHandler(APIException.class)
    @ResponseBody
    public ResultCode apiException(APIException aPIException){
        ErrorCode errorCode = aPIException.getErrorCode();
        return new ResultCode(errorCode);
    }
}
